



********************************************************
** Table 5
********************************************************

* For spillover regressions 


global data="C:\CFLs\Data\"
global outputs="C:\CFLs\Outputs\"

clear
clear matrix
clear mata

set maxvar 10000
set matsize 11000

cd "$data"

global format=`"nogap label nostar starlevels(* 0.1 ** 0.05 *** 0.01) collabels(none) cells(b(star fmt(3) label(Coef.)) se(par fmt(3) label(Std.Err.))) csv"'
global statsFEshort=`"stats(N r2, fmt(0 a2) labels("Observations" "R-squared")) "'




use "CFLs_data_panel.dta", clear 



**** Version to use (March 15, 2018) Updated for RESTAT R+R 2/23/2019

tabstat bulb_cfl_tot_ if TGH_S==0 & TGL_S==0 & TGH_T==0 & TGL_T==0 & post==0, stat(mean N) 

global regoutfile, clear 
global regoutfile = "Table_spill_panel_USE.csv" 
eststo clear


*COL 1 
eststo: xtreg bulb_cfl_tot_  TGH_T_post TGL_T_post CFLs_trtmt TGH_S_post TGL_S_post TGH_S  TGL_S  TGH_T TGL_T  post  i.hh_id, cluster(within_village_cluster)
test TGH_T_post = TGL_T_post
test TGH_S_post = TGL_S_post 

*COL 2
eststo: xtreg bulb_cfl_tot_  TGH_T_post TGL_T_post CFLs_trtmt TGH_S_close_post  TGL_S_close_post TGHL_S_far_post  TGHL_S_far  TGH_T TGL_T TGH_S_close  TGL_S_close    post  i.hh_id, cluster(within_village_cluster)
test TGH_T_post = TGL_T_post
test TGH_S_close_post = TGL_S_close_post
esttab using $regoutfile, keep(_cons post TGH_T_post TGL_T_post CFLs_trtmt  TGH_S_post TGL_S_post TGH_S_close_post TGL_S_close_post  TGHL_S_far_post  TGHL_S_far ) $format $statsFEshort title("TABLE X: Outcome= CFL spillover ") replace 

